<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/style.css">
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<fmt:setBundle basename="Messages" />
<title><fmt:message key="Display.ModifyStaff" /></title>
<link rel="stylesheet" type="text/css" href="css/style.css"
	media="screen" />
<link rel="stylesheet" href="jquery.treeview.css" />
<link rel="stylesheet" href="screen.css" />

<script src="lib/jquery.js" type="text/javascript"></script>
<script src="lib/jquery.cookie.js" type="text/javascript"></script>
<script src="jquery.treeview.js" type="text/javascript"></script>

<script type="text/javascript" src="demo.js"></script>
<script>
	<script src="http://code.jquery.com/jquery-latest.js">
</script>
<script type="text/javascript"
	src="http://jzaefferer.github.com/jquery-validation/jquery.validate.js"></script>
<style type="text/css">
* {
	font-family: Verdana;
	font-size: 96%;
}

label {
	width: 10em;
	float: left;
}

label.error {
	float: none;
	color: red;
	padding-left: .5em;
	vertical-align: top;
}

p {
	clear: both;
}

.submit {
	margin-left: 12em;
}

em {
	font-weight: bold;
	padding-right: 1em;
	vertical-align: top;
}
</style>
<script>
	$(document).ready(function() {
		$("#commentForm").validate();
	});
</script>
</head>
<body>
	<img src="img/logo_ISS.jpg" class="logo" />
	<div class="header">
		<div style="float: left; margin: 11px auto 0 auto">
			<h1>
				<fmt:message key="Display.InstituteofSystemScience" />
			</h1>
		</div>
		<div style="float: right; margin: 11px auto 0 auto">
			<h1>
				<fmt:message key="Display.FacilitiesBookingSystem" />
			</h1>
		</div>
	</div>
	<div class="site_content">
		<div class="sidebar_container">
			<div class="sidebar">
				<%@include file="adminSideMenu.jsp" %>
			</div>
		</div>

		<div class="content">

			<form method="post" action="SearchStaffServlet" class="cmxform"
				id="commentForm">
				<input type="text" name="searchByName" id="search" class="required" />&nbsp;&nbsp;&nbsp;&nbsp;
				<input style="size: autosize" type="submit"
					value=<fmt:message key="Display.SearchBYID"/> class="ButtonStyle"><br />
				<table class="borderall" cellpadding=4 cellspacing=2 border=0>
					<tr>
						<th>#</th>
						<th><fmt:message key="Display.Name" /></th>
						<th><fmt:message key="Display.StaffID" /></th>
						<th><fmt:message key="Display.Reportto" /></th>
						<th><fmt:message key="Display.Role" /></th>
						<th><fmt:message key="Display.Edit" /></th>
						<th><fmt:message key="Display.Delete" /></th>
					</tr>
					<c:if test="${searchedStaff !=null }">
						<c:forEach var="staff" items="${searchedStaff}" varStatus="status">

							<tr class="${status.index%2==0?'even':'odd'}">
								<td class="nowrap">${status.index + 1}</td>
								<td class="nowrap">${staff.getName()}</td>
								<td class="nowrap">${staff.getStaffID()}</td>
								<td class="nowrap">${staff.getReportTo()}</td>
								<td class="nowrap">${staff.getLoginCreds().getRole() }</td>
								<td class="nowrap"><c:url var="updurl" scope="page"
										value="/CreateStaff.jsp">
										<c:param name="name" value="${staff.getName()}" />
										<c:param name="staffID" value="${staff.getStaffID()}" />
										<c:param name="reportto" value="${staff.getReportTo()}" />
										<c:param name="email" value="${staff.getEmail()} " />
										<c:param name="role"
											value="${staff.getLoginCreds().getRole() }" />
										<c:param name="phone" value="${staff.getPhoneNumber()} " />
										<c:param name="securityQ"
											value="${staff.getLoginCreds().getSecurityQuestion() }" />
										<c:param name="securityA"
											value="${staff.getLoginCreds().getSecurityAnswer() }" />
										<c:param name="update" value="true" />
									</c:url> <a href="${updurl}" onclick="submit"><fmt:message
											key="Display.editStaff" /></a></td>
								<td><c:url var="delurl" scope="page"
										value="/DeleteStaffServlet">
										<c:param name="staffID" value="${staff.getStaffID()}" />
									</c:url> <a href="${delurl}"><fmt:message key="Display.deleteStaff" /></a>
								</td>
							</tr>
						</c:forEach>
					</c:if>
					<c:if test="${searchedStaff ==null }">
						<label><fmt:message key="Display.StaffNotFound"></fmt:message></label>
					</c:if>
					<c:forEach var="staff" items="${allstaff}" varStatus="status">

						<tr class="${status.index%2==0?'even':'odd'}">
							<td class="nowrap">${status.index + 1}</td>
							<td class="nowrap">${staff.getName()}</td>
							<td class="nowrap">${staff.getStaffID()}</td>
							<td class="nowrap">${staff.getReportTo()}</td>
							<td class="nowrap">${staff.getLoginCreds().getRole() }</td>
							<td class="nowrap"><c:url var="updurl" scope="page"
									value="/CreateStaff.jsp">
									<c:param name="name" value="${staff.getName()}" />
									<c:param name="staffID" value="${staff.getStaffID()}" />
									<c:param name="reportto" value="${staff.getReportTo()}" />
									<c:param name="email" value="${staff.getEmail()} " />
									<c:param name="role"
										value="${staff.getLoginCreds().getRole() }" />
									<c:param name="phone" value="${staff.getPhoneNumber()} " />
									<c:param name="securityQ"
										value="${staff.getLoginCreds().getSecurityQuestion() }" />
									<c:param name="securityA"
										value="${staff.getLoginCreds().getSecurityAnswer() }" />
									<c:param name="update" value="true" />
								</c:url> <a href="${updurl}" onclick="submit"><fmt:message
										key="Display.editStaff" /></a></td>
							<td><c:url var="delurl" scope="page"
									value="/DeleteStaffServlet">
									<c:param name="staffID" value="${staff.getStaffID()}" />
								</c:url> <a href="${delurl}"><fmt:message key="Display.deleteStaff" /></a>
							</td>
						</tr>
					</c:forEach>

				</table>
			</form>
		</div>

	</div>

	<div class="footer" style="align: center">Copyright@ Team3
		Erudites</div>


</body>
</html>